<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="root" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>租赁管理</title>
<link href="${root}/static/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="${root}/static/js/jquery-1.12.4.js"></script>
<script type="text/javascript" src="${root}/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${root}/static/js/vue.min.js"></script>
<script type="text/javascript" src="${root}/static/js/axios.min.js"></script>
<script type="text/javascript" src="${root}/static/js/My97DatePicker/WdatePicker.js"></script>
</head>
<body>
	<div id="app" class="container-fluid">
		<div class="col-md-2" style="margin-top: 20px">
			<input type="text" v-model="rtid" @keyup="search()"
				placeholder="请输入租赁单号关键字" class="form-control" />
		</div>
		<div class="col-md-2" style="margin-top: 20px">
			<button @click="all()"
				class="btn btn-default glyphicon glyphicon-search">所有租赁单</button>
		</div>
		<table class="table">
			<caption>租赁列表</caption>
			<thead>
				<tr>
					<th>出租单号</th>
					<th>身份证号</th>
					<th>车牌号</th>
					<th>出租价格</th>
					<th>出租押金</th>
					<th>超期价格</th>
					<th>起租时间</th>
					<th>归还时间</th>
					<th>租赁备注</th>
					<th>状态</th>
				</tr>
			</thead>
			<tbody>
				<tr v-for="item in pager.items">
					<td>{{item.rtid}}</td>
					<td>{{item.rtctid}}</td>
					<td>{{item.rtbsno}}</td>
					<td>{{item.rtprice}}元/天</td>
					<td>{{item.rtdeposit}}元</td>
					<td>{{item.rtextprice}}元</td>
					<td>{{item.rtbeginS}}</td>
					<td>{{item.rtreturnS}}</td>
					<td class="text-info">{{item.rtdesc}}</td>
					<td>
						<button class="btn btn-info" disabled="disabled">{{item.rtstatuszh}}</button>
					</td>
				</tr>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="10">
						<ul class="pagination">
							<li><a href="javascript:void(0);" @click="list(1)">&laquo;</a></li>
							<li><a href="javascript:void(0);" @click="list(pager.begin-pager.step)">&larr;</a></li>
						</ul>
						<ul class="pagination" v-for="n in pager.end+1-pager.begin">
							<li :class="pager.begin+n-1==pager.index?'active':''"><a
								href="javascript:void(0);" @click="list(pager.begin+n-1)">{{pager.begin+n-1}}</a>
							</li>
						</ul>
						<ul class="pagination">
							<li><a href="javascript:void(0);" @click="list(pager.begin+pager.step)">&rarr;</a></li>
							<li><a href="javascript:void(0);" @click="list(pager.page)">&raquo;</a></li>
						</ul>
					</td>
				</tr>
			</tfoot>
		</table>
	</div>
	<script type="text/javascript">
		new Vue({
			el : '#app',
			data : {
				index : 1,
				size : 5,
				step : 10,
				rtid : "",
				pager : {},
			},
			methods : {
				list : function(index) {
					var self = this;
					self.index = index;
					var url = "${root}/rent/list?rtid=" + self.rtid + "&index=" + self.index + "&size=" + self.size + "&step=" + self.step;
					axios.get(url).then(function(res) {
						self.pager = res.data;
					});
				},
				search : function() {
					var self = this;
					self.index = 1;
					self.list(self.index);
				},
				all : function() {
					var self = this;
					self.rtid = "";
					self.index = 1;
					self.list(self.index);
				},
			},
			mounted : function() {
				this.list(this.index);
			}
		})
	</script>
</body>
</html>